import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Main {
    public static void main(String[] args) {
    //1.
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");

            try {
                Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/jdbc?characterEncoding=utf-8", "root", "121628");
                if (connection != null){
                    System.out.println("连接成功");
                }
                String sql ="select * from user";


            } catch (SQLException e) {
                throw new RuntimeException(e);
            }

        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }


    }
}







